<%@ Page Language="C#" MasterPageFile="~/MasterPageMcSigAdmin.master" AutoEventWireup="true"
    CodeFile="ComisionesBaseLiquidacion.aspx.cs" Inherits="ComisionesBaseLiquidacion" Title="Untitled Page" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register assembly="DevExpress.Web.v12.2, Version=12.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView.Export" tagprefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:SqlDataSource ID="SqlDataSourcePermisosEpes" runat="server" ConnectionString="<%$ ConnectionStrings:MCSIGConnectionString %>"
        SelectCommand="SELECT    COM_BASE_LIQUIDACION.CBL_ID, COM_BASE_LIQUIDACION.CBL_RANGO_MINIMO, COM_BASE_LIQUIDACION.CBL_RANGO_MAXIMO, COM_BASE_LIQUIDACION.CBL_MONTO_VIATICOS_DIARIOS, COM_BASE_LIQUIDACION.CTD_ID, COM_BASE_LIQUIDACION.AMO_ID, COM_BASE_LIQUIDACION.CRE_ID, COM_REGIONES.CRE_NOMBRE, ADM_MONEDAS.AMO_NOMBRE, COM_TIPO_DESTINO.CTD_NOMBRE,  COM_BASE_LIQUIDACION.CBL_TIPO FROM         COM_BASE_LIQUIDACION INNER JOIN COM_TIPO_DESTINO ON COM_BASE_LIQUIDACION.CTD_ID = COM_TIPO_DESTINO.CTD_ID INNER JOIN ADM_MONEDAS ON COM_BASE_LIQUIDACION.AMO_ID = ADM_MONEDAS.AMO_ID INNER JOIN COM_REGIONES ON COM_BASE_LIQUIDACION.CRE_ID = COM_REGIONES.CRE_ID"
        DeleteCommand="DELETE FROM [COM_BASE_LIQUIDACION] WHERE [CBL_ID] = @CBL_ID" 
        InsertCommand="INSERT INTO COM_BASE_LIQUIDACION  ([CBL_RANGO_MINIMO] ,[CBL_RANGO_MAXIMO] ,[CBL_MONTO_VIATICOS_DIARIOS] ,[CTD_ID] ,[AMO_ID] ,[CRE_ID], CBL_TIPO) VALUES  (@CBL_RANGO_MINIMO ,@CBL_RANGO_MAXIMO ,@CBL_MONTO_VIATICOS_DIARIOS ,@CTD_ID ,@AMO_ID ,@CRE_ID, @CBL_TIPO)"
        UpdateCommand="UPDATE COM_BASE_LIQUIDACION SET CBL_RANGO_MINIMO = @CBL_RANGO_MINIMO ,CBL_RANGO_MAXIMO = @CBL_RANGO_MAXIMO ,CBL_MONTO_VIATICOS_DIARIOS = @CBL_MONTO_VIATICOS_DIARIOS ,CTD_ID = @CTD_ID ,AMO_ID = @AMO_ID  ,CRE_ID = @CRE_ID , CBL_TIPO = @CBL_TIPO  WHERE CBL_ID = @CBL_ID">
        <DeleteParameters>
            <asp:Parameter Name="CBL_ID" Type="Decimal" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="CBL_RANGO_MINIMO" Type="Decimal" />
            <asp:Parameter Name="CBL_RANGO_MAXIMO" Type="Decimal" />
            <asp:Parameter Name="CBL_MONTO_VIATICOS_DIARIOS" Type="Decimal" />
            <asp:Parameter Name="CTD_ID" Type="Decimal" />
            <asp:Parameter Name="AMO_ID" Type="Decimal" />
            <asp:Parameter Name="CRE_ID" Type="Decimal" />
            <asp:Parameter Name="CBL_ID" Type="Decimal" />
            <asp:Parameter Name="CBL_TIPO" Type="String" />

        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="CBL_RANGO_MINIMO" Type="Decimal" />
            <asp:Parameter Name="CBL_RANGO_MAXIMO" Type="Decimal" />
            <asp:Parameter Name="CBL_MONTO_VIATICOS_DIARIOS" Type="Decimal" />
            <asp:Parameter Name="CTD_ID" Type="Decimal" />
            <asp:Parameter Name="AMO_ID" Type="Decimal" />
            <asp:Parameter Name="CRE_ID" Type="Decimal" />
            <asp:Parameter Name="CBL_TIPO" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>


    <asp:SqlDataSource ID="SqlDataSourceMonedas" runat="server" ConnectionString="<%$ ConnectionStrings:MCSIGConnectionString %>"
        SelectCommand="SELECT AMO_ID, AMO_NOMBRE     FROM ADM_MONEDAS ">
    </asp:SqlDataSource>
    <br />
    <asp:SqlDataSource ID="SqlDataSourceDestinos" runat="server" ConnectionString="<%$ ConnectionStrings:MCSIGConnectionString %>"
        SelectCommand="SELECT [CTD_ID], [CTD_NOMBRE] FROM [COM_TIPO_DESTINO]"></asp:SqlDataSource>


    <asp:SqlDataSource ID="SqlDataSourceTipoRegiones" runat="server" ConnectionString="<%$ ConnectionStrings:MCSIGConnectionString %>"
        SelectCommand="SELECT [CRE_ID], [CRE_NOMBRE] FROM [COM_REGIONES]"></asp:SqlDataSource>


    &nbsp;<dx:aspxgridviewexporter id="gridExport" runat="server" gridviewid="ASPxGridView1"> </dx:aspxgridviewexporter>
    <dx:ASPxGridView ID="ASPxGridView1" runat="server" CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css"
        CssPostfix="PlasticBlue" AutoGenerateColumns="False" DataSourceID="SqlDataSourcePermisosEpes"
        KeyFieldName="CBL_ID" Theme="PlasticBlue">
        <Styles CssPostfix="PlasticBlue" CssFilePath="~/App_Themes/PlasticBlue/{0}/styles.css">
            <Header SortingImageSpacing="10px" ImageSpacing="10px">
            </Header>
        </Styles>
        <SettingsPager ShowDefaultImages="False">
            <AllButton Text="All">
            </AllButton>
            <NextPageButton Text="Next &gt;">
            </NextPageButton>
            <PrevPageButton Text="&lt; Prev">
            </PrevPageButton>
        </SettingsPager>
      
        <StylesEditors>
            <CalendarHeader Spacing="11px">
            </CalendarHeader>
            <ProgressBar Height="25px">
            </ProgressBar>
        </StylesEditors>
        <Columns>
            <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                <EditButton Visible="True">
                </EditButton>
                <NewButton Visible="True">
                </NewButton>
                <DeleteButton Visible="True">
                </DeleteButton>
                <ClearFilterButton Visible="True">
                </ClearFilterButton>
            </dx:GridViewCommandColumn>
            <dx:GridViewDataTextColumn FieldName="CBL_ID" ReadOnly="True" VisibleIndex="1">
                <EditFormSettings Visible="True" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="CBL_RANGO_MINIMO" VisibleIndex="2">
                <EditFormSettings Visible="True" />
                <PropertiesTextEdit DisplayFormatString="{0:N0}">
                        </PropertiesTextEdit>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="CBL_RANGO_MAXIMO" VisibleIndex="2">
                <EditFormSettings Visible="True" />
                <PropertiesTextEdit DisplayFormatString="{0:N0}">
                        </PropertiesTextEdit>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="CBL_MONTO_VIATICOS_DIARIOS" VisibleIndex="2">
                <EditFormSettings Visible="True" />
                <PropertiesTextEdit DisplayFormatString="{0:N0}">
                        </PropertiesTextEdit>
            </dx:GridViewDataTextColumn>

            <dx:GridViewDataComboBoxColumn Caption="Region" FieldName="CRE_ID" VisibleIndex="1"
                Visible="True" Width="300px">
                <EditFormSettings Visible="True" />
                <PropertiesComboBox CallbackPageSize="15" TextField="CRE_NOMBRE" ValueField="CRE_ID"
                    DataSourceID="SqlDataSourceTipoRegiones" EnableCallbackMode="True" EnableIncrementalFiltering="True"
                    ValueType="System.String">
                </PropertiesComboBox>
                <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" ShowFilterRowMenu="True" />
            </dx:GridViewDataComboBoxColumn>



            <dx:GridViewDataComboBoxColumn Caption="Destino" FieldName="CTD_ID" VisibleIndex="1"
                Width="300px">
                <EditFormSettings Visible="True" />
                <PropertiesComboBox CallbackPageSize="15" TextField="CTD_NOMBRE" ValueField="CTD_ID"
                    DataSourceID="SqlDataSourceDestinos" EnableCallbackMode="True" EnableIncrementalFiltering="True"
                    ValueType="System.String">
                </PropertiesComboBox>
                <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" ShowFilterRowMenu="True" />
            </dx:GridViewDataComboBoxColumn>

            <dx:GridViewDataTextColumn FieldName="AMO_NOMBRE" Caption="AMO_NOMBRE" ReadOnly="True"
                VisibleIndex="4" Width="300px">
                <EditFormSettings Visible="False" />
            </dx:GridViewDataTextColumn>

            <dx:GridViewDataComboBoxColumn Caption="Monedas" FieldName="AMO_ID" VisibleIndex="1"
                Visible="False" Width="300px">
                <EditFormSettings Visible="True" />
                <PropertiesComboBox CallbackPageSize="15" TextField="AMO_NOMBRE" ValueField="AMO_ID"
                    DataSourceID="SqlDataSourceMonedas" EnableCallbackMode="True" EnableIncrementalFiltering="True"
                    ValueType="System.String">
                </PropertiesComboBox>
                <Settings AutoFilterCondition="Contains" FilterMode="DisplayText" ShowFilterRowMenu="True" />
            </dx:GridViewDataComboBoxColumn>

             <dx:GridViewDataTextColumn FieldName="CBL_TIPO" Caption="TIPO" 
                VisibleIndex="10" Width="200px">
                <EditFormSettings  />
            </dx:GridViewDataTextColumn>
      
        </Columns>
        <Settings ShowFilterRow="True" ShowGroupPanel="True" ShowFilterRowMenu="True" />
    </dx:ASPxGridView>
    <asp:Button ID="btnXlsExport" runat="server" CssClass="button m tp-space10" OnClick="btnXlsExport_Click"
        Text="Exportar a XLS" />
</asp:Content>
